<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="../js/vue.js"></script>
</head>
<body>
<div id="app">
    {{a}}
    <button @click="a='222'">change it</button>
</div>
<script>
    var data={a:1};
    //如果把freeze 放到new Vue后面，无效
    Object.freeze(data);
    var vm=new Vue({
        el:"#app",
        data:data
    });
    //watch监控值的变化
    vm.$watch('a',function (newVal,oldVal) {
        // 这个回调将在 `vm.a` 改变后调用
        console.log(newVal,"---",oldVal)
    });

    console.log(vm.$data === data); // => true
    console.log(vm.$el === document.getElementById('app')); // => true
</script>
</body>
</html>